package com.smartcruise.report;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;

import com.flyco.dialog.listener.OnBtnClickL;
import com.flyco.dialog.listener.OnOperItemClickL;
import com.flyco.dialog.widget.NormalDialog;
import com.flyco.dialog.widget.NormalListDialog;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.config.PictureMimeType;
import com.luck.picture.lib.entity.LocalMedia;
import com.smartcruise.R;
import com.smartcruise.data.Contacts;
import com.smartcruise.data.ReportData;
import com.smartcruise.data.cruiseData.CruiseData;
import com.smartcruise.data.cruiseData.ReportType;
import com.smartcruise.service.LocationManager;
import com.smartcruise.util.FileUtils;
import com.smartcruise.util.IntentUtils;
import com.smartcruise.util.Key;
import com.smartcruise.util.ListUtils;
import com.smartcruise.util.TempleUser;
import com.smartcruise.util.TimeUtils;
import com.smartcruise.util.network.OssManager;
import com.smartcruise.util.network.ReportUpload;
import com.smartcruise.util.network.callBack.BaseCallBack;
import com.smartcruise.util.network.callBack.SimpleCallBack;
import com.smartcruise.util.network.netUtils.NetCollection;
import com.smartcruise.util.network.netUtils.NetStatusUtils;
import com.smartcruise.util.network.netUtils.Result;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import io.realm.Realm;
import io.realm.RealmResults;
import io.realm.Sort;

/**
 * Created by FengChaoQun
 * on 2018/1/25 0025
 */

public class ReportDataPresenterImp implements ReportDataContract.Presenter {

    private ReportDataContract.View mView;
    private ReportData reportData;
    private CruiseData cruiseData;
    private EditType editType;

    private ArrayList<String> audioList = new ArrayList<>();
    private ArrayList<String> imageList = new ArrayList<>();
    private ArrayList<String> videoList = new ArrayList<>();
    private AudioAdapter audioAdapter;
    private ImageAdapter imageAdapter;
    private VideoAdapter videoAdapter;
    private String currentImagePath, currentVideoPath;
    private boolean modify;
    private boolean isNetDataChanged;
    private String auditorId;//审核人员id 如果是巡航任务的通报 则直接就是任务的审核人 否则 让用户选择
    private String typeId;

    public ReportDataPresenterImp(ReportDataContract.View mView, ReportData reportData, CruiseData cruiseData, EditType editType) {
        this.mView = mView;
        this.editType = editType;
        this.reportData = reportData;
        this.cruiseData = cruiseData;
        modify = editType != EditType.VIEW;
    }

    @Override
    public void start() {
        initData();
        audioAdapter = new AudioAdapter(getActivity(), R.layout.item_audio, audioList, this);
        audioAdapter.setModify(modify);
        imageAdapter = new ImageAdapter(getActivity(), R.layout.item_audio, imageList, this);
        imageAdapter.setModify(modify);
        videoAdapter = new VideoAdapter(getActivity(), R.layout.item_audio, videoList, this);
        videoAdapter.setModify(modify);
        mView.setData(audioAdapter, imageAdapter, videoAdapter);

        if (EditType.CREATE.equals(editType)) {
            if (cruiseData != null) {
                auditorId = cruiseData.getAuditorId();
                mView.setAuditPeople(cruiseData.getAuditor().getUserName());
            }
//            selectAuditPeople();
        }
    }

    private void initData() {
        if (editType == EditType.MODIFY || editType == EditType.VIEW) {
            if (reportData == null) {
                mView.showToast(mView.getActivity().getString(R.string.nothingToShow));
                mView.getActivity().finish();
            } else {
                mView.setText(reportData.getText());
                if (ListUtils.isHaveContent(reportData.getShowImage())) {
                    imageList.addAll(reportData.getShowImage());
                }
                if (ListUtils.isHaveContent(reportData.getShowVideo())) {
                    videoList.addAll(reportData.getShowVideo());
                }
                if (ListUtils.isHaveContent(reportData.getShowAudio())) {
                    audioList.addAll(reportData.getShowAudio());
                }

                if (!TextUtils.isEmpty(reportData.getAuditorId())) {
                    auditorId = reportData.getAuditorId();
                    Contacts auditor = mView.getRealm().where(Contacts.class)
                            .equalTo(Key.id, reportData.getAuditorId()).findFirst();
                    if (auditor != null) {
                        mView.setAuditPeople(auditor.getUserName());
                    }
                }

                if (!TextUtils.isEmpty(reportData.getType())) {
                    typeId = reportData.getType();
                    ReportType first = mView.getRealm().where(ReportType.class)
                            .equalTo(Key.id, reportData.getType()).findFirst();
                    if (first != null) {
                        mView.setType(first.getName());
                    }
                }

            }
        }

        switch (editType) {
            case CREATE:
                mView.showDeleteButton(false);
                mView.showSaveButton(true);
                mView.showUploadButton(true);
                break;
            case MODIFY:
                mView.showDeleteButton(true);
                mView.showSaveButton(true);
                mView.showUploadButton(true);
                break;
            case VIEW:
                mView.showDeleteButton(false);
                mView.showSaveButton(false);
                mView.showUploadButton(false);
                break;
        }

    }

    private Activity getActivity() {
        return mView.getActivity();
    }

    @Override
    public void addAudio(String audioPath) {
        audioList.add(audioPath);
        mView.notifyAudiosChange(audioAdapter);
    }

    @Override
    public void reduceAudio(String audioPath) {
        audioList.remove(audioPath);
        mView.notifyAudiosChange(audioAdapter);
        //如果是删除了已上传的数据 则标记为数据已变动
        if (OssManager.isOssUrl(audioPath)) {
            isNetDataChanged = true;
        }
    }

    @Override
    public void addImage(String imagePath) {
        imageList.add(imagePath);
        mView.notifyImagesChange(imageAdapter);
    }

    @Override
    public void reduceImage(String imagePath) {
        imageList.remove(imagePath);
        mView.notifyImagesChange(imageAdapter);
        //如果是删除了已上传的数据 则标记为数据已变动
        if (OssManager.isOssUrl(imagePath)) {
            isNetDataChanged = true;
        }
    }

    @Override
    public void addVideo(String videoPath) {
        videoList.add(videoPath);
        mView.notifyVideosChange(videoAdapter);
    }

    @Override
    public void reduceVideo(String videoPath) {
        videoList.remove(videoPath);
        mView.notifyVideosChange(videoAdapter);
        //如果是删除了已上传的数据 则标记为数据已变动
        if (OssManager.isOssUrl(videoPath)) {
            isNetDataChanged = true;
        }
    }

    @Override
    public void selectType() {
//        final String[] type = new String[]{"偷猎", "伐木"};
//        final NormalListDialog listDialog = new NormalListDialog(getActivity(), type);
//        listDialog.title(getActivity().getString(R.string.pleaseSelectType));
//        listDialog.setOnOperItemClickL(new OnOperItemClickL() {
//            @Override
//            public void onOperItemClick(AdapterView<?> parent, View view, int position, long id) {
//                mView.setType(type[position]);
//                listDialog.dismiss();
//            }
//        });
//        listDialog.show();

        NetCollection.getReportType(mView, new SimpleCallBack(mView) {
            @Override
            public void onSuccess(Result result) {
                final RealmResults<ReportType> all = mView.getRealm().
                        where(ReportType.class).findAll().sort("orderNum", Sort.ASCENDING);
                if (all.isEmpty()) {
                    mView.showToast("没有找到类型信息");
                    return;
                }
                String[] typeNames = new String[all.size()];
                for (int i = 0; i < all.size(); i++) {
                    ReportType reportType = all.get(i);
                    String type = reportType.getName();
                    if (!TextUtils.isEmpty(reportType.getPriority())) {
                        type = type + "(" + reportType.getPriority() + ")";
                    }
                    typeNames[i] = type;
                }
                final NormalListDialog normalListDialog = new NormalListDialog(getActivity(), typeNames);
                normalListDialog.title(getActivity().getString(R.string.pleaseSelectType));
                normalListDialog.layoutAnimation(null);
                normalListDialog.setOnOperItemClickL(new OnOperItemClickL() {
                    @Override
                    public void onOperItemClick(AdapterView<?> parent, View view, int position, long id) {
                        typeId = all.get(position).getId();
                        mView.setType(all.get(position).getName());
                        normalListDialog.dismiss();
                    }
                });
                normalListDialog.show();
            }
        });
    }

    /**
     * description:选择审核人员
     */
    @Override
    public void selectAuditPeople() {
        if (cruiseData != null) {
            auditorId = cruiseData.getAuditorId();
            mView.setAuditPeople(cruiseData.getAuditor().getUserName());
            return;
        }
        NetCollection.getContacts(mView, new SimpleCallBack(mView) {
            @Override
            public void onSuccess(Result result) {
                final RealmResults<Contacts> allContacts = mView.getRealm().where(Contacts.class)
                        .equalTo("auditor", "是")
                        .not().equalTo(Key.id, TempleUser.getInstance().getAccount())
                        .findAll();

                if (allContacts.isEmpty()) {
                    mView.showToast("本地没有找到审核人员信息");
                    return;
                }

                String[] strings = new String[allContacts.size()];
                for (int i = 0; i < allContacts.size(); i++) {
                    strings[i] = allContacts.get(i).getUserName();
                }
                final NormalListDialog normalListDialog = new NormalListDialog(getActivity(), strings);
                normalListDialog.title("选择审核人员");
                normalListDialog.layoutAnimation(null);
                normalListDialog.setOnOperItemClickL(new OnOperItemClickL() {
                    @Override
                    public void onOperItemClick(AdapterView<?> parent, View view, int position, long id) {
                        auditorId = allContacts.get(position).getId();
                        mView.setAuditPeople(allContacts.get(position).getUserName());
                        normalListDialog.dismiss();
                    }
                });
                normalListDialog.show();
            }
        });
    }

    /**
     * description:退出的时候 如果当前是可编辑状态且有数据的话 提示用户保存数据
     */

    @Override
    public void clickOnBack() {
        if (editType == EditType.VIEW) {//浏览模式 直接退出
            mView.getActivity().finish();
        } else if (editType == EditType.MODIFY) {//编辑模式 检查内容是否变动 没有变动则直接退出
            if (!isDataChanged()) {
                mView.getActivity().finish();
            } else {
                showSaveDataDialog();
            }
        } else {//创建模式
            if (reportData == null) {//通报数据尚未创建 如果当前页面没有数据 直接退出
                if (isPageHaveData()) {
                    showSaveDataDialog();
                } else {
                    getActivity().finish();
                }
            } else {//已经创建了数据 则检查有无变动 没有则直接退出
                if (isDataChanged()) {
                    showSaveDataDialog();
                } else {
                    getActivity().finish();
                }
            }
        }
    }

    private void showSaveDataDialog() {
        final NormalDialog normalDialog = new NormalDialog(getActivity());
        normalDialog.content("需要保存修改的数据吗?");
        normalDialog.btnText(getActivity().getString(R.string.cancel), getActivity().getString(R.string.templeSave));
        normalDialog.setOnBtnClickL(new OnBtnClickL() {
            @Override
            public void onBtnClick() {
                normalDialog.dismiss();
                getActivity().finish();
            }
        }, new OnBtnClickL() {
            @Override
            public void onBtnClick() {//保存数据
                normalDialog.dismiss();
                saveData();
                mView.showToast("数据已保存");
                getActivity().finish();
            }
        });
        normalDialog.show();
    }

    /**
     * description:检查页面数据是否有变动
     */
    private boolean isDataChanged() {
        if (!reportData.isFromNet()) {//本地数据 检查本地数据变动
            return !ListUtils.isStringSame(mView.getText(), reportData.getText())
                    || !ListUtils.isStringSame(typeId, reportData.getType())
                    || !ListUtils.isStringSame(auditorId, reportData.getAuditorId())
                    || !ListUtils.isContentSame(imageList, reportData.getOriginalImage())
                    || !ListUtils.isContentSame(videoList, reportData.getOriginalVideos())
                    || !ListUtils.isContentSame(audioList, reportData.getOriginalAudios());
        } else {
            //从服务器下载的数据 检查本地和已上传的数据变动
            if (isNetDataChanged) {
                return true;
            }
            if (!ListUtils.isStringSame(mView.getText(), reportData.getText())) {
                return true;
            }
            //检查图片
            ArrayList<String> originalImage = new ArrayList<>();
            for (String s : imageList) {
                if (!OssManager.isOssUrl(s)) {
                    originalImage.add(s);
                }
            }
            if (!ListUtils.isContentSame(originalImage, reportData.getOriginalImage())) {
                return true;
            }
            //检查视频
            ArrayList<String> originalVideo = new ArrayList<>();
            for (String s : videoList) {
                if (!OssManager.isOssUrl(s)) {
                    originalVideo.add(s);
                }
            }
            if (!ListUtils.isContentSame(originalVideo, reportData.getOriginalVideos())) {
                return true;
            }
            //检查语音
            ArrayList<String> originalAudio = new ArrayList<>();
            for (String s : audioList) {
                if (!OssManager.isOssUrl(s)) {
                    originalAudio.add(s);
                }
            }
            if (!ListUtils.isContentSame(originalAudio, reportData.getOriginalAudios())) {
                return true;
            }
        }
        return false;

    }

    /**
     * description:保存数据
     */

    private void saveData() {
        if (editType == EditType.CREATE && reportData == null) {//如果是创建模式 并且reportData还没有创建 则先创建
            reportData = new ReportData();
            reportData.setId(String.valueOf(TimeUtils.currentTime()));
            reportData.setAuditorId(auditorId);
            reportData.setInspectorId(TempleUser.getInstance().getAccount());
            if (cruiseData != null) {
                reportData.setPatrollingTaskId(cruiseData.getPatrollingTaskId());
            }
            reportData.setCreateTime(TimeUtils.currentTime());
//            reportData.setDataChanged(true);//设置数据变动
            reportData.setName(TempleUser.getInstance().getUserInfo().getUserName() + "-" + TimeUtils.getSimpleTimeString(TimeUtils.currentTime()));
            mView.getRealm().executeTransaction(new Realm.Transaction() {
                @Override
                public void execute(Realm realm) {
                    reportData = realm.copyToRealmOrUpdate(reportData);
                }
            });
        }
        if (!reportData.isFromNet()) {//本地数据 直接保存图片等到原数据
            mView.getRealm().executeTransaction(new Realm.Transaction() {
                @Override
                public void execute(Realm realm) {
                    if (isDataChanged()) {
//                        reportData.setDataChanged(true);
                        //数据变动后 改变上传状态为未上传 需要重新上传
                        reportData.setUploadStatus(0);
                    }
                    reportData.setText(mView.getText());
                    reportData.setType(typeId);
                    reportData.setAuditorId(auditorId);
                    reportData.setOriginalImage(imageList);
                    reportData.setOriginalVideos(videoList);
                    reportData.setOriginalAudios(audioList);
                    reportData.setLocation(LocationManager.getInstance().getLastData());
                }
            });
        } else {//服务器拉取的数据 图片等分开存储
            //过滤图片
            final ArrayList<String> netImage = new ArrayList<>();
            final ArrayList<String> originalImage = new ArrayList<>();
            if (ListUtils.isHaveContent(imageList)) {
                for (String s : imageList) {
                    if (OssManager.isOssUrl(s)) {
                        netImage.add(s);
                    } else {
                        originalImage.add(s);
                    }
                }
            }
            //过滤视频
            final ArrayList<String> netVideo = new ArrayList<>();
            final ArrayList<String> originalVideo = new ArrayList<>();
            if (ListUtils.isHaveContent(videoList)) {
                for (String s : videoList) {
                    if (OssManager.isOssUrl(s)) {
                        netVideo.add(s);
                    } else {
                        originalVideo.add(s);
                    }
                }
            }
            //过滤音频
            final ArrayList<String> netAudio = new ArrayList<>();
            final ArrayList<String> originalAudio = new ArrayList<>();
            if (ListUtils.isHaveContent(audioList)) {
                for (String s : audioList) {
                    if (OssManager.isOssUrl(s)) {
                        netAudio.add(s);
                    } else {
                        originalAudio.add(s);
                    }
                }
            }
            mView.getRealm().executeTransaction(new Realm.Transaction() {
                @Override
                public void execute(Realm realm) {
                    if (isDataChanged()) {
                        reportData.setDataChanged(true);
                        //数据变动后 改变上传状态为未上传 需要重新上传
                        reportData.setUploadStatus(0);
                    }
                    reportData.setOriginalImage(originalImage);
                    reportData.refreshUploadedImage(netImage);
                    reportData.setOriginalVideos(originalVideo);
                    reportData.refreshUploadedVideo(netVideo);
                    reportData.setOriginalAudios(originalAudio);
                    reportData.refreshUploadedAudio(netAudio);
                    reportData.setText(mView.getText());
                    reportData.setType(typeId);
                    reportData.setAuditorId(auditorId);
                    reportData.setLocation(LocationManager.getInstance().getLastData());
                }
            });
        }
        Log.d("ReportDataPresenterImp", reportData.getType());
    }

    /**
     * description:检查页面是否有数据
     */

    private boolean isPageHaveData() {
        return !TextUtils.isEmpty(mView.getText()) || !TextUtils.isEmpty(mView.getType()) || ListUtils.isHaveContent(imageList)
                || ListUtils.isHaveContent(audioList) || ListUtils.isHaveContent(videoList);
    }

    /**
     * description:删除数据 只能删除已保存的数据
     */

    @Override
    public void delete() {
        if (reportData != null) {
            final NormalDialog normalDialog = new NormalDialog(getActivity());
            normalDialog.content("确定删除本页数据?")
                    .btnText("删除", "取消")
                    .setOnBtnClickL(new OnBtnClickL() {
                        @Override
                        public void onBtnClick() {
                            deleteData();
                            normalDialog.dismiss();
                            mView.showToast(getActivity().getString(R.string.deleted));
                            mView.getActivity().finish();
                        }
                    }, new OnBtnClickL() {
                        @Override
                        public void onBtnClick() {
                            normalDialog.dismiss();
                        }
                    });
            normalDialog.show();
        } else {
            mView.getActivity().finish();
        }
    }

    private void deleteData() {
        mView.getRealm().executeTransaction(new Realm.Transaction() {
            @Override
            public void execute(Realm realm) {
                reportData.deleteFromRealm();
            }
        });
    }

    /**
     * description:暂存数据
     */

    @Override
    public void clickOnSave() {
        if (editType == EditType.CREATE && !isPageHaveData()) {
            mView.showToast("没有数据需要保存");
            return;
        }
        saveData();
        mView.showToast("数据已保存");
        getActivity().finish();
    }

    //上传数据
    @Override
    public void clickOnUpload() {

        if (editType == EditType.CREATE && !isPageHaveData()) {
            mView.showToast("没有数据需要上传");
            return;
        }

        saveData();

        if (reportData.checkLocalContent()) {
            checkNetAndUpload();
        } else {
            NormalDialog normalDialog = new NormalDialog(getActivity());
            normalDialog.content("请确认已经选择了审核人、事件类型且填写至少一项通报内容")
                    .show();
        }

    }

    private void checkNetAndUpload() {
        if (NetStatusUtils.isConnected(getActivity())) {
            if (NetStatusUtils.isWifi(getActivity())) {//wifi环境下 全部上传
                uploadData(true);
            } else {//不是WiFi的时候 如果有大文件要上传 提醒用户 让其选择
                if (reportData.isHaveBigLocalFile()) {
                    final NormalDialog normalDialog = new NormalDialog(getActivity());
                    normalDialog.content("当前使用的是数据流量,上传全部文件会消耗较多流量,是否仅上传概要数据?")
                            .btnText("上传全部数据", "上传概要数据")
                            .setOnBtnClickL(new OnBtnClickL() {
                                @Override
                                public void onBtnClick() {
                                    uploadData(true);
                                    normalDialog.dismiss();
                                }
                            }, new OnBtnClickL() {
                                @Override
                                public void onBtnClick() {
                                    uploadData(false);
                                    normalDialog.dismiss();
                                }
                            });
                    normalDialog.show();
                } else {
                    uploadData(true);
                }
            }
        } else {
            mView.showToast("网络异常,请检查网络状况");
        }
    }

    private void uploadData(boolean all) {
        ReportUpload reportUpload = new ReportUpload(mView, reportData);
        BaseCallBack baseCallBack = new SimpleCallBack(mView) {
            @Override
            public void onSuccess(Result result) {
                mView.showToast("上传成功");
                getActivity().finish();
            }
        };
        if (all) {
            reportUpload.uploadOneNodeAllData(baseCallBack);
        } else {
            reportUpload.uploadOneNodeSimpleData(baseCallBack);
        }
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode != Activity.RESULT_OK) {
            return;
        }

        switch (requestCode) {
            case IntentUtils.AUDIO_RECORD:
                if (data != null) {
                    String path = data.getStringExtra(IntentUtils.DATA);
                    if (path != null) {
                        addAudio(path);
                    }
                }
                break;
            case IntentUtils.TAKE_PICTURE:
                addImage(currentImagePath);
                break;
            case IntentUtils.PICK_PICTURE:
                if (data.getData() != null) {
                    addImage(IntentUtils.getRealFilePath(mView.getActivity(), data.getData()));
                }
                break;
            case PictureConfig.CHOOSE_REQUEST:
                // 图片、视频、音频选择结果回调
                List<LocalMedia> selectList = PictureSelector.obtainMultipleResult(data);
                // 例如 LocalMedia 里面返回三种path
                // 1.media.getPath(); 为原图path
                // 2.media.getCutPath();为裁剪后path，需判断media.isCut();是否为true  注意：音视频除外
                // 3.media.getCompressPath();为压缩后path，需判断media.isCompressed();是否为true  注意：音视频除外
                // 如果裁剪并压缩了，以取压缩路径为准，因为是先裁剪后压缩的
                if (ListUtils.isHaveContent(selectList)) {
                    for (LocalMedia localMedia : selectList) {
                        imageList.add(localMedia.getPath());
                    }
                    mView.notifyImagesChange(imageAdapter);
                }
                break;
            case IntentUtils.TAKE_VIDEO:
                addVideo(currentVideoPath);
                break;
            case IntentUtils.PICK_VIDEO:
                if (data.getData() != null) {
                    addVideo(IntentUtils.getRealFilePath(mView.getActivity(), data.getData()));
                }
                break;

        }
    }

    @Override
    public void openAudioRecord() {
        if (audioList.size() >= 6) {
            mView.showToast(getActivity().getString(R.string.audioLimit));
            return;
        }
        AudioRecordActivity.start(getActivity());
    }

    @Override
    public void openCamera() {
        if (imageList.size() >= 6) {
            mView.showToast(getActivity().getString(R.string.imageLimit));
            return;
        }
        final NormalListDialog normalListDialog = new NormalListDialog(getActivity(), new String[]{"拍照", "从本地选择"});
        normalListDialog.setOnOperItemClickL(new OnOperItemClickL() {
            @Override
            public void onOperItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch (position) {
                    case 0:
                        currentImagePath = FileUtils.getNewImagePath();
                        IntentUtils.takePhoto(getActivity(), Uri.fromFile(new File(currentImagePath)));
                        break;
                    case 1:
//                        IntentUtils.pickPhoto(mView.getActivity());
                        PictureSelector.create(mView.getActivity())
                                .openGallery(PictureMimeType.ofImage())
                                .maxSelectNum(6 - imageList.size())
                                .compress(false)
                                .forResult(PictureConfig.CHOOSE_REQUEST);
                        break;
                }
                normalListDialog.dismiss();
            }
        });
        normalListDialog.show();
    }

    @Override
    public void openVideo() {
        if (videoList.size() >= 3) {
            mView.showToast(getActivity().getString(R.string.videoLimit));
            return;
        }
        final NormalListDialog normalListDialog = new NormalListDialog(getActivity(), new String[]{"录制视频", "从本地选择"});
        normalListDialog.setOnOperItemClickL(new OnOperItemClickL() {
            @Override
            public void onOperItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch (position) {
                    case 0:
                        currentVideoPath = FileUtils.getNewVideoPath();
                        IntentUtils.takeVideo(getActivity(), Uri.fromFile(new File(currentVideoPath)));
                        break;
                    case 1:
                        IntentUtils.pickVideo(mView.getActivity());
                        break;
                }
                normalListDialog.dismiss();
            }
        });
        normalListDialog.show();
    }

    @Override
    public void openScan() {

    }
}
